<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>2017.4.24 router</title>
    <script src="../vue.js"></script>
    <script src="../vue-router.js"></script>
</head>

<body>
    <div id="app">
        <p>当前数字被点击了{{fullName}}次</p>
        <p>{{num}}</p>
        <button type="button" v-on:click="Myadd">add</button>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    firstName: 'Foo',
                    lastName: 'Bar',
                    num:1
                }
            },
            watch: {
                
            },
            computed: {
               fullName:{
                   get:function(){
                       return this.num-1
                   },
                   set:function(newval){
                    this.num  = newval +'set'
                   }
               }
            },
            methods: {
                Myadd:function(){
                   this.num = this.num + 1
                }
            }
        })

    </script>
</body>

</html>